If the menu is closed while it is being opened, we should skip the next
animation in the chain. Similarly, if a menu is opened while it is being
closed, we should continue the animation from the previous state instead
of resetting height to 0.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5843
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2481>
reactive: true,
x_expand: true,
y_expand: false,
+ height: 0,
constraints,
});
this.actor._delegate = this;
this.actor.show();
this.isOpen = true;
+ const previousHeight = this.actor.height;
this.actor.height = -1;
const [targetHeight] = this.actor.get_preferred_height(-1);
+ this.actor.height = previousHeight;
+ const distance = Math.abs(targetHeight - previousHeight);
const duration = animate !== PopupAnimation.NONE
? POPUP_ANIMATION_TIME / 2
: 0;
- this.actor.height = 0;
this.box.opacity = 0;
this.actor.ease({
- duration,
+ duration: duration * (distance / targetHeight),
height: targetHeight,
onComplete: () => {
this.box.ease({
if (!this.isOpen)
return;
+ const {opacity} = this.box;
const duration = animate !== PopupAnimation.NONE
? POPUP_ANIMATION_TIME / 2
: 0;
this.box.ease({
- duration,
+ duration: duration * (opacity / 255),
opacity: 0,
onComplete: () => {
this.actor.ease({